23 #define foreach(x, v) for (typeof (v).begin() x=(v).begin(); x !=(v).end(); ++x)
24 #define For(i, a, b) for (int i=(a); i<(b); ++i)
25 #define D(x) cout << #x " is " << x << endl
27 pair
<int, int> g
[10001];
29 bool compare(const pair
<int, int> &a
, const pair
<int, int> &b
) {
30 if (a
.first
!= b
.first
) return a
.first
< b
.first
;
31 return a
.second
> b
.second
;
37 while (scanf("%lld %d", &L
, &n
) == 2) {
38 if (L
== 0 and n
== 0) break;
40 for (int i
= 0; i
< n
; ++i
) {
41 long long x
, r
; scanf("%lld %lld", &x
, &r
);
42 g
[i
].first
= max(0LL, x
- r
);
43 g
[i
].second
= min(L
, x
+ r
);
45 sort(g
, g
+ n
, compare
);
56 for (int j
= i
; j
< n
and g
[j
].first
<= g
[i
].second
; ++j
) {
57 if (g
[j
].second
> g
[best
].second
) {
61 covered
= g
[best
].second
;
69 printf("%d\n", n
- ans
);